package org.teststack.LoginModule;



import java.util.HashMap;
import java.util.Map;

import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.teststack.utils.ReadConf.getHost1;

public class LoginApi {


    public static void main(String[] args) {
        login("1","2");

    }

    public static  void login(String username, String password) {


            String host = getHost1();
            String url = host + "/api/v1/product/detail";


            Map<String, String> para = new HashMap<String, String>();
            para.put("username", username);
            para.put("password", password);
            given().

                    params(para).         //????
                    when().
                    get(url).
                    then().
                    statusCode(200).
                    body("code", equalTo(0)).
                    body("msg", equalTo(null)).
                    log().all();
        }
    }


